package com.burger.dao;

import com.burger.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {
    @Insert("insert into db_book1 values(#{id},#{type},#{name},#{price},#{status})")
    public void save(Book book);

    @Update("update db_book1 set type = #{type}, name = #{name}, price = #{price} , status = #{status} where id=#{id}")
    public void update(Book book);

    @Delete("delete from db_book1 where id = #{id}")
    public void delete(Integer id);

    @Select("select * from db_book1 where id = #{id}")
    public Book getById(Integer id);

    @Select("select * from db_book1")
    public List<Book> getAll();

    @Update("update db_book1 set status=status-1 where id=#{id}")
    public void down(Integer id);

    @Update("update db_book1 set status=status+1 where id=#{id}")
    public void up(Integer id);
}
